//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __ELA_LOVEC_H__
#define __ELA_LOVEC_H__

#ifndef JFFS2_SSIZE_T
#define JFFS2_SSIZE_T
typedef unsigned long ssize_t;
#endif
//=============================================================================
// IO vector descriptors

typedef struct ELA_IOVEC_TAG
{
    char           *iov_base;           /* Base address. */
    ssize_t        iov_len;             /* Length. */
}
ela_iovec;

enum ela_uio_rw { UIO_READ, UIO_WRITE };

/* Segment flag values. */
enum ela_uio_seg
{
    UIO_USERSPACE,          /* from user data space */
    UIO_SYSSPACE          /* from system space */
};

typedef struct ELA_UIO_TAG
{
    struct ELA_IOVEC_TAG *uio_iov; /* pointer to array of iovecs */
    int                  uio_iovcnt; /* number of iovecs in array */
    off_t         uio_offset; /* offset into file this uio corresponds to */
    ssize_t       uio_resid; /* residual i/o count */
    enum ela_uio_seg     uio_segflg;    /* see above */
    enum ela_uio_rw      uio_rw;        /* see above */
}
ela_uio;

// Limits

#define kvec ELA_IOVEC_TAG
#define UIO_SMALLIOV 8  /* 8 on stack, else malloc */

#endif /* __ELA_IOVEC_H__ */
